package cn.com.generaldata.os.vo;

import java.util.HashMap;

//@JsonSerialize(using = JsonResultSerializer.class)
public class JsonResult extends HashMap {

	private static final long serialVersionUID = 3832526620450440106L;

	// public static final int OK = 200;
	// public static final int FAIL = 500;

	private JsonResult() {
	}

	public static JsonResult make() {
		return new JsonResult();
	}

	public static JsonResult ok() {
		return make().set("ok", true);
	}

	public static JsonResult ok(String message) {
		return make().set("ok", true).set("message", message);
	}

	public static JsonResult error() {
		return make().set("ok", false);
	}

	public static JsonResult error(String message) {
		return make().set("ok", false).set("message", message);
	}

	public JsonResult set(String key, Object value) {
		this.put(key, value);
		return this;
	}

	public JsonResult set(String k1, Object v1, String k2, Object v2) {
		set(k1, v1).set(k2, v2);
		return this;
	}

	public JsonResult set(String k1, Object v1, String k2, Object v2, String k3, Object v3) {
		set(k1, v1).set(k2, v2).set(k3, v3);
		return this;
	}

}
